﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FrienDev.Data;
using FrienDev.BusinessRules;

public partial class Activity_ActivityMessageBoard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            int activityId = 0;
            if (HttpContext.Current.Request["activityId"] == null)
            {
                Response.Redirect("~/home/default.aspx");
            }
            else
            {
                int.TryParse(HttpContext.Current.Request["activityId"], out activityId);
                Activity ac = ActivityRules.Instance.GetActivityInfo(activityId);
                if (ac == null)
                {
                    Response.Redirect("~/home/default.aspx");
                }
                else
                {
                    lb_Title.Text += ac.ActivityName;
                }
            }
            if (ActivityRules.Instance.IsActivityNeedPermit(activityId))
            {
                ActivityMemberCandidate.Visible = true;
            }
            else
            {
                ActivityMemberCandidate.Visible = false;
            }
        }
    }

    public new void RegisterOnSubmitStatement(string key, string script)
    {
        ScriptManager.RegisterOnSubmitStatement(this, typeof(Page), key, script);
    }

    [Obsolete]
    public override void RegisterStartupScript(string key, string script)
    {
        string newScript = script.Replace("FTB_AddEvent(window,'load',function () {", "").Replace("});", "");
        ScriptManager.RegisterStartupScript(this, typeof(Page), key, newScript, false);
    }
}
